package com.emep.changzhi.analyse.utils;

import com.emep.changzhi.analyse.entity.basics.SysDepartmentInfo;
import lombok.Data;
import org.springframework.data.domain.Page;

import java.util.ArrayList;
import java.util.List;

@Data
public class PageChunk<T> {
    private List<T> content = new ArrayList<>();
    private long totalElements;
    private int totalPages;
    private int number;

    public PageChunk<T> pageChunk(Page<T> page) {
        PageChunk<T> chunk = new PageChunk();
        chunk.setContent(page.getContent());
        chunk.setTotalPages(page.getTotalPages());
        chunk.setTotalElements(page.getTotalElements());
        chunk.setNumber(page.getNumber());
        return chunk;

    }
}